﻿using System;
using System.Web;
using System.IO;

public class log
{
    public static void Logging(string Text)
    {
        string str;
        str = HttpContext.Current.Server.MapPath("~/logs/error.log");

        try
        {
            using (StreamWriter writer = File.AppendText(str))
            {
                writer.Write("\r\n" + DateTime.Now.ToString() + "\t" + Text + "\r\n");
                writer.Close();
            }
        }
        catch
        {}
    }

    public static void Logging(Exception ex)
    {
        Logging(ex.Message + "\r\n" + ex.Source + "\r\n" + ex.TargetSite.Name + "\r\n" + ex.StackTrace);
    }
}